/**
*      author: Y_Yao
*      created: 2024-10-11 19:41:19
**/

#include<bits/stdc++.h>

using namespace std;
using LL = long long;
const int INF = 0x3f3f3f3f;
const int N = 2e5 + 9;
LL a[N];

void solve()
{
    LL n,sum;
    cin >> n >> sum;

    LL Sum = 0;
    for(int i = 0;i < n;i++)
    {
        cin >> a[i];
        Sum += a[i];
    }
    sort(a,a+n);

    LL diff = sum - Sum;
    int ret = 0;

    if(diff < 0)//要减少
    {
        LL newsum;
        for(int i = n - 1;i >= 0;i--)
        {
            newsum = Sum - a[i] + (-10000);
            diff = sum - newsum;
            ret++;
            if(diff >= 0) break;
            Sum = newsum;
        }
    } 
    else if(diff > 0)//要增加
    {
        LL newsum;
        for(int i = 0;i < n;i++)
        {
            newsum = Sum - a[i] + 10000;
            diff = sum - newsum;
            ret++;
            if(diff <= 0) break;
            Sum = newsum;
        }
    }

    cout << ret << endl;
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);

    int t = 1;
    cin >> t;
    while(t--)
    {
        solve();
    }
    return 0;
}